Skip to content

fix(aiv): harden state manager — memory caps, path validation, 404s#10

Open
joys0714 wants to merge 1 commit intodevfrom
joys0714/aiv-hardening
Open

fix(aiv): harden state manager — memory caps, path validation, 404s#10
joys0714 wants to merge 1 commit intodevfrom
joys0714/aiv-hardening

Conversation

@joys0714
Copy link
Copy Markdown
Collaborator

@joys0714 joys0714 commented Apr 7, 2026

Summary

  • Cap touchedFiles at 500 entries/session and strategyChanges at 50 entries/session to prevent unbounded memory growth
  • Add isFilePath() validation to reject URLs (http://, https://, //), strings with tabs/newlines, and strings >500 chars
  • Add periodic idle-session sweep: evicts sessions idle >30 minutes, runs every 5 minutes
  • Return 404 for GET /aiv/intent/:sessionID when session doesn't exist (was returning synthetic empty intent)

Addresses P0 "Cap memory growth" + "Fix isFilePath" and P1 "Return 404 for non-existent sessions" from review hardening tasks.

Test plan

  • Verify isFilePath rejects URLs, tab/newline strings, and long strings
  • Verify isFilePath accepts valid paths (relative, absolute, tilde)
  • Verify GET /aiv/intent/:nonexistent returns 404
  • Verify touched files stop growing after 500 entries
  • Verify strategy changes array stays at most 50 entries
  • Verify idle sessions are evicted after 30 minutes

🤖 Generated with Claude Code

… 404s

Cap touchedFiles at 500 per session and strategyChanges at 50. Add
isFilePath validation to reject URLs, garbage, and overly long strings.
Add periodic idle-session sweep (30min TTL, 5min interval). Return 404
for non-existent sessions on GET /aiv/intent/:sessionID.

Addresses P0/P1 hardening tasks from review notes.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant